package com.example.recyclerdemo;

import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import com.example.recyclerdemo.room.StudentEntity;

import java.util.List;

public class StudentDAO {
    public StudentDAO(MainActivity mainActivity) {
    }

    @Query("select * from stu_room")
    List<StudentEntity> getAll() {
        return null;
    }

    // 根据条件进行查询，使用||拼接字符串
    @Query("select * from stu_room where student_name like '%'||:kw||'%' or classmate like '%'||:kw||'%'")
    List<StudentEntity> getAll(String kw) {
        return null;
    }

    @Insert
    void insert(StudentEntity student) {

    }

    // 根据student的id更新所有列的值
    @Update
    void update(StudentEntity student) {

    }

    // 更新年龄
    @Query("update stu_room set age = :age where id = :id")
    void update(int id, int age) {

    }

    // 根据id进行删除
    @Query("delete from stu_room where id = :id")
    void delete(int id) {

    }

    @Delete
    void delete(StudentEntity student) {

    }

    public List<Student> getAllStudent() {
        return null;
    }

    public List<Student> getStudent(String kw) {
        return null;
    }

    public List<Student> getStudents(String kw) {
        return null;
    }
}
